﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ComeSeeThis_MVC2.Models.TireFormView>" %>

<%@ Import Namespace="ComeSeeThis_MVC2.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Edit Tire
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("SubMenu"); %>
    <h2>
        Edit Tire</h2>
    <table>
        <tr>
            <td valign="top">
                <% using (Html.BeginForm())
                   {%>
                <% Html.RenderPartial("TireForm"); %>
                <% } %>
            </td>
            <td valign="top">
                <fieldset>
                    <legend>Applies To:</legend>
                    <% using (Ajax.BeginForm("SubmitVehicleType", new AjaxOptions { UpdateTargetId = "SubmittedVehicles" }))
                       { %>
                    <input type="hidden" id="tireId" name="tireId" value="<%: Model.TireId %>" />
                    <select id="vehicleTypeId" name="vehicleTypeId">
                        <% foreach (var vehicleType in Model.VehicleTypes)
                           {%>
                        <option value="<%: vehicleType.VehicleTypeId %>">1/<%: vehicleType.Scale %>
                            <%: vehicleType.VehicleTypeName %></option>
                        <% } %>
                        <% } %>
                    </select>
                    <input type="submit" value="Add Vehicle Type" />
                </fieldset>
                <div id="SubmittedVehicles">
                    <% Html.RenderPartial("VehicleTypeList", new VehicleTypeTireFormView(Model.TireId));%>
                </div>
            </td>
        </tr>
    </table>
    <p>
        <%: Html.ActionLink("Delete", "Delete", new {id=Model.TireId}) %>
    </p>
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="BodyTagContent" runat="server">
</asp:Content>
